// components/search/search.js
  var maxW = wx.getSystemInfoSync().windowWidth;
  var maxH = wx.getSystemInfoSync().windowHeight;

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    propType:{
      type:Number,
      value:1
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    searchImg:'/images/search.png',
    listImg: '/images/list.png',
    addImg: '/images/add1.png',
    maxH: maxH,
    maxW: maxW,
    x: maxW-80,
    y: maxH-100,
    changeX:300,
    changeY: 0,
    isShow:false
  },
  ready: function () {
    
  },

  /**
   * 组件的方法列表
   */
  methods: {
    
    //手指触摸开始
    seacherStart(e){
      this.setData({
        startL: e.changedTouches[0].clientX,
        startB: maxH-e.changedTouches[0].clientY
        //bottom: e.changedTouches[0].clientY-20
      })

    },
    //手指触摸后移动
    seacherMove(e) {
      //console.log(e)
      let left = e.changedTouches[0].clientX;
      left = left > 15 ? left:15;
      left = left < maxW - 50 ? left : maxW - 50;
      let bottom = maxH - e.changedTouches[0].clientY;
      bottom = bottom > 10 ? bottom : 10;
      bottom = bottom < maxH - 45 ? bottom : maxH - 45;
      this.setData({
        left: left,
        bottom: bottom
      })
    },
    //点击事件
    seacherTap(e){

    },
    //改变位置
    changeSearch(e){
      let changeX = e.detail.x;
      let changeY = e.detail.y;
      this.setData({
        changeX: changeX,
        changeY: changeY
      })
    },
    //添加
    onAdd(e){
      this.triggerEvent('myClick');
    },
    //搜索
    onSearch(e){
      let obj = {};
      obj.isSearch = true;
      this.triggerEvent('mySearch', obj);
    },
    //打开list
    open(){
      this.setData({
        isShow: !(this.data.isShow)
      })
    }
  }
})
